//显示所有的order订单

getAllOrder();
function getAllOrder() {
    var customerId = $(".customerid").val();
    $.ajax({
        type:"GET",
        url:"/fresh/order/getAll/"+customerId,
        dataType:"json",
        success:function (result) {
            if (result.status==1){
                console.log("查询订单成功");

                $(".mc-ul").html("");
                var str ="";
                $.each(result.data,function (index,orderList) {
                    var orderId = orderList.orders.orderId;
                    var orderTime = orderList.orders.orderCreatetime;
                    var orderNumber = orderList.orders.orderNumber;
                    var orderTotalprice = orderList.orders.orderTotalprice;
                    var payStatus = orderList.orders.payStatus;
                    var addressId = orderList.address.addressId;
                    var addressCust = orderList.address.addressCust;
                    var addressProvince = orderList.address.addressProvince;
                    var addressCity = orderList.address.addressCity;
                    var addressArea = orderList.address.addressArea;
                    var addressDetails = orderList.address.addressDetails;

                    var ele =" <li class=\"mc-ul-li\">\n" +
                        "                        <input type=\"hidden\" class=\"orderId\" value="+orderId+" name=\"orderId\">\n" +
                        "                        <div class=\"mc-head\">\n" +
                        "                            <div class=\"order-num\">\n" +
                        "                                <span class=\"dingdanhao\">订单号:</span>\n" +
                        "                                <span class=\"order-num-span\">"+orderNumber+"</span>\n" +
                        "                                <span class=\"order-p\">￥</span>\n" +
                        "                                <span class=\"order-price\">"+orderTotalprice+"</span>\n" +
                        "                                <span class=\"address-cust\">"+addressCust+"</span>\n" +
                        "                                <span class=\"order-pay\">已支付</span>\n" +
                        "                            </div>\n" +
                        "\n" +
                        "\n" +
                        "                        </div>\n" +
                        "\n" +
                        "                        <div class=\"ordr-address\">\n" +
                        "                                <span class=\"address-mess\">"+addressProvince+""+addressCity+""+addressArea+""+addressDetails+"</span>\n" +
                        "\n" +
                        "                            <a href=\"javascript:getDetails("+orderId+");\" class=\"a-orderdetails\">查看详情</a>\n" +
                        "                        </div>\n" +
                        "\n" +
                        "\n" +
                        "\n" +
                        "\n" +
                        "                    </li>"
                    str +=ele;
                })

                $(".mc-ul").html(str);



            }else {
                console.log("c查询订单失败");
            }
        }
    })
}

//点击查询详情跳转到后端modelandview 跳转到详情页面上去
function getDetails(orderId) {
    window.location.href ="/fresh/order/toDetails/"+orderId;
}